package com.anmong.parser.model;
import java.util.Objects;

/**
 * 用于表示单个SRT字幕条目的数据结构 (兼容 Java 11 的 Class 版本)。
 */
public final class SubtitleEntry {

    private final int sequence;
    private final String startTime;
    private final String endTime;
    private final String text;

    public SubtitleEntry(int sequence, String startTime, String endTime, String text) {
        this.sequence = sequence;
        this.startTime = startTime;
        this.endTime = endTime;
        this.text = text;
    }

    // --- Getters ---
    public int getSequence() {
        return sequence;
    }

    public String getStartTime() {
        return startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public String getText() {
        return text;
    }

    // --- equals, hashCode, toString ---
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SubtitleEntry that = (SubtitleEntry) o;
        return sequence == that.sequence && Objects.equals(startTime, that.startTime) && Objects.equals(endTime, that.endTime) && Objects.equals(text, that.text);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sequence, startTime, endTime, text);
    }

    @Override
    public String toString() {
        return "SubtitleEntry[" +
                "sequence=" + sequence + ", " +
                "startTime='" + startTime + "', " +
                "endTime='" + endTime + "', " +
                "text='" + text + "']";
    }
}